import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by 14229 on 2020/2/21.
 */
public class Test04 {
    public static void main(String[] args) throws IOException {
        List<String> list = new ArrayList<>();
        List<String> lines = FileUtils.readLines(new File("num.txt"), "UTF-8");
        for (String line : lines) {
            if (line.contains("+")){
                String[] split = line.split("\\+");
                double a = Double.parseDouble(split[0])+Double.parseDouble(split[1]);
                list.add(split[0]+"+"+split[1]+"="+a);
            }else if (line.contains("-")){
                String[] split = line.split("\\-");
                double a = Double.parseDouble(split[0])-Double.parseDouble(split[1]);
                list.add(split[0]+"-"+split[1]+"="+a);
            }else if (line.contains("*")){
                String[] split = line.split("\\*");
                double a = Double.parseDouble(split[0])*Double.parseDouble(split[1]);
                list.add(split[0]+"*"+split[1]+"="+a);
            }else if (line.contains("/")){
                String[] split = line.split("\\/");
                double a = Double.parseDouble(split[0])/Double.parseDouble(split[1]);
                list.add(split[0]+"/"+split[1]+"="+a);
            }else if (line.contains("%")){
                String[] split = line.split("\\%");
                double a = Double.parseDouble(split[0])%Double.parseDouble(split[1]);
                list.add(split[0]+"%"+split[1]+"="+a);
            }
        }
        FileUtils.writeLines(new File("num.txt"),list);
    }
}
